package proxy.jdkproxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @program: java-base->MyInvocation
 * @description: invocation
 * @author: G_Y
 * @create: 2019-08-19 18:48
 **/
public class MyInvocation implements InvocationHandler {

//    public Object proxyObj;

    private Object obj;

    public MyInvocation(Object obj) {
        this.obj = obj;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("代理方法执行前");
        Object result = method.invoke(obj, args);
//        this.proxyObj = proxy;
        System.out.println("代理方法执行后");
        return result;
    }
}
